home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Reference & Presen…tion Library 4 (Reseller)
/
Apple Ref. & Pres. Lib.v4.0.iso
/
5-Fonts & Software
/
Demo Software
/
Wingz
/
Scripts
/
calc
(
.txt
)
next >
Wrap
Wingz Script
|
1989-02-08
|
10KB
|
225 lines
WNGZWZSC01b1
1on mousedown call calc:putchar("1") end mousedown
1on mousedown call calc:putchar("2") end mousedown
1on mousedown call calc:putchar("3") end mousedown
1on mousedown call calc:putchar("4") end mousedown
1on mousedown call calc:putchar("5") end mousedown
1on mousedown call calc:putchar("6") end mousedown
1on mousedown call calc:putchar("7") end mousedown
1on mousedown call calc:putchar("8") end mousedown
1on mousedown call calc:putchar("9") end mousedown
0
1on mousedown call calc:putchar("0") end mousedown
1on mousedown call calc:putchar(".") end mousedown
zon mousedown
calc:formula = ""
field text "0"
select field text from 32767 to 32767
calc:wasop = 1
end mousedown
.on mousedown call calc:doop("^") end mousedown
.on mousedown call calc:doop("/") end mousedown
.on mousedown call calc:doop("*") end mousedown
.on mousedown call calc:doop("-") end mousedown
.on mousedown call calc:doop("+") end mousedown
-on mousedown call calc:recalc() end mousedown
.on mousedown call calc:doop("(") end mousedown
.on mousedown call calc:doop(")") end mousedown
Dollar
Franc
Pound
.on mousedown call calc:convert() end mousedown
Ex. Rates
,on mousedown call calc:rates() end mousedown
Quit Calculator
International Calculator
Exchange Rates: $1.0 U.S. =
Franc
Cancel@
hcalc:dm = ctstring(2,0) calc:franc = ctstring(3,0)
calc:yen = ctstring(4,0) calc:pound = ctstring(5,0)
calc:result =
calc:result = (
franc
pound
formula
result
wasop
lastcur
clator
rates
recalcd
putchar9
convert
define dm,franc,yen,pound,formula,result,wasop,lastcur
function clator()
define xoff, yoff
dm = 1.749
franc = 5.976
yen = 123.21
pound = 0.5486
formula = ""
wasop = 1
lastcur = 1
xoff = 0
yoff = 200
new modal dialog box at (-1,-1) (4800,5400)
add push button "1" at (1700+xoff,3000+yoff)+(650,600)
script "on mousedown call calc:putchar(""1"") end mousedown"
add push button "2" at (2450+xoff,3000+yoff)+(650,600)
script "on mousedown call calc:putchar(""2"") end mousedown"
add push button "3" at (3200+xoff,3000+yoff)+(650,600)
script "on mousedown call calc:putchar(""3"") end mousedown"
add push button "4" at (1700+xoff,2300+yoff)+(650,600)
script "on mousedown call calc:putchar(""4"") end mousedown"
add push button "5" at (2450+xoff,2300+yoff)+(650,600)
script "on mousedown call calc:putchar(""5"") end mousedown"
add push button "6" at (3200+xoff,2300+yoff)+(650,600)
script "on mousedown call calc:putchar(""6"") end mousedown"
add push button "7" at (1700+xoff,1600+yoff)+(650,600)
script "on mousedown call calc:putchar(""7"") end mousedown"
add push button "8" at (2450+xoff,1600+yoff)+(650,600)
script "on mousedown call calc:putchar(""8"") end mousedown"
add push button "9" at (3200+xoff,1600+yoff)+(650,600)
script "on mousedown call calc:putchar(""9"") end mousedown"
add push button "0 " at (1700+xoff,3700+yoff)+(1400,600)
script "on mousedown call calc:putchar(""0"") end mousedown"
add push button "." at (3200+xoff,3700+yoff)+(650,600)
script "on mousedown call calc:putchar(""."") end mousedown"
add push button "C" at (1700+xoff,900+yoff)+(650,600)
script "on mousedown
calc:formula = """"
field text ""0""
select field text from 32767 to 32767
calc:wasop = 1
end mousedown"
add push button "^" at (2450+xoff,900+yoff)+(650,600)
script "on mousedown call calc:doop(""^"") end mousedown"
add push button "/" at (3200+xoff,900+yoff)+(650,600)
script "on mousedown call calc:doop(""/"") end mousedown"
add push button "*" at (3950+xoff,900+yoff)+(650,600)
script "on mousedown call calc:doop(""*"") end mousedown"
add push button "-" at (3950+xoff,1600+yoff)+(650,600)
script "on mousedown call calc:doop(""-"") end mousedown"
add push button "+" at (3950+xoff,2300+yoff)+(650,600)
script "on mousedown call calc:doop(""+"") end mousedown"
add push button "=" at (3950+xoff,3000+yoff)+(650,1300)
script "on mousedown call calc:recalc() end mousedown"
add push button "(" at (200+xoff,900+yoff)+(650,600)
script "on mousedown call calc:doop(""("") end mousedown"
add push button ")" at (950+xoff,900+yoff)+(650,600)
script "on mousedown call calc:doop("")"") end mousedown"
add field at (200+xoff,200+yoff)+(4400,400)
field justification right
field text "0"
select field text from 32767 to 32767
add radio button "Dollar","DM","Franc","Yen","Pound" at
(200+xoff,2300+yoff)+(1400,2000)
no line border
script "on mousedown call calc:convert() end mousedown"
add push button "Ex. Rates" at (200+xoff,1600+yoff)+(1400,600)
script "on mousedown call calc:rates() end mousedown"
add push button "Quit Calculator" at (500+xoff,4400+yoff) +(2.5 inch, .45 inch)
dialog cancel push button
select control 24
thick inner line border
add text " International Calculator" at (600,0)+(2.4 inch, 18 point )
select control 25
no line border
use dialog box
end function
function rates()
new modal dialog box at (-1,-1) (5000,5000)
add text "Exchange Rates: $1.0 U.S. =" at (600,100) +(3 inches,700)
no line border
add field at (200,900) (4800,1300)
field text dm
show control name "DM"
add field at (200,1600) (4800,2000)
field text franc
show control name "Franc"
add field at (200,2300) (4800,2700)
field text yen
show control name "Yen"
add field at (200,3000) (4800,3400)
field text pound
show control name "
add push button "OK@", "Cancel@" at (4000, 3500) (4800, 4800)
dialog cancel push button
select control 6
dialog default push button
script "calc:dm = ctstring(2,0) calc:franc = ctstring(3,0)
calc:yen = ctstring(4,0) calc:pound = ctstring(5,0)"
use dialog box
end function
function recalc()
invalidate on
formula = "calc:result =" & formula & ctstring(21,0)
run formula
select control 21
field text result
select field text from 32767 to 32767
formula = ""
invalidate off
end function
function doop(character)
if character <> "("
formula = formula & ctstring(21,0) & character
else
formula = formula & character
end if
wasop = 1
if (character = ")" or character = "(")
select control 21
field text ""
select field text from 32767 to 32767
end if
end function
function putchar(character)
define string
invalidate on
select control 21
if wasop
string = character
wasop = 0
else
string = ctstring(21,0) & character
end if
field text string
select field text from 32767 to 32767
invalidate off
end function
function convert()
define cur
cur = ctvalue(22,0)
if cur <> lastcur
formula = "calc:result = (" & formula & ctstring(21,0) & ")"
case lastcur
when 2
formula = formula & "/" & dm
when 3
formula = formula & "/" & franc
when 4
formula = formula & "/" & yen
when 5
formula = formula & "/" & pound
end case
case cur
when 2
formula = formula & "*" & dm
when 3
formula = formula & "*" & franc
when 4
formula = formula & "*" & yen
when 5
formula = formula & "*" & pound
end case
run formula
select control 21
field text result
select field text from 32767 to 32767
formula = ""
lastcur = cur
end if
end function